<template>
  <div class="company">
    <div class="tips">{{ languageJson.message.selectcompany }}</div>
    <div style="margin-top: 6px">
      <template v-if="userStore.user.products.data_feed">
        <div class="company_item">
          <div>
            <el-checkbox v-model="state.allcompany" @change="settingtore.changeallcompany" />
          </div>
          <div class="text">
            <div class="label">{{ languageJson.setting.selectAll }}</div>
            <div class="buttons">
              <div>{{ languageJson.setting.terms }}</div>
            </div>
          </div>
        </div>

        <div
          class="company_item"
          v-for="(item, index) in userStore.user.products.data_feed.list"
          :key="index"
        >
          <div>
            <el-checkbox-group v-model="state.formData.bc_types" @change="settingtore.changeformData">
              <el-checkbox label="" :value="item.attr_code" />
            </el-checkbox-group>
          </div>
          <div class="text">
            <div class="label">{{ languageJson.bctypes[item.attr_code] }}</div>
            <div class="buttons">
              <div>{{ languageJson.setting.terms }}</div>
              <div style="margin-left: 12px">{{ languageJson.setting.rule }}</div>
            </div>
          </div>
        </div>
      </template>
      <template v-else>
        <el-empty :image-size="60" style="padding: 0;margin-top: 40px" :description="languageJson.message.nodata" />
      </template>
    </div>
  </div>
</template>

<script setup>
const userStore = useUserStore()
const languageJson = inject('languageJson')
const languageType = inject('languageType')
const { settingtore, state } = inject('SettingStore')
</script>

<style lang="scss" scoped>
.company_item {
  display: flex;
  align-items: center;

  .tips {
    font-family: AlibabaPuHuiTi_2_65_;
    font-size: 12px;
    color: #999;
  }

  .text {
    flex: 1;
    display: flex;
    justify-content: space-between;
    margin-left: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(55, 17, 216, 0.08);

    .label {
      font-family: AlibabaPuHuiTi_2_65_;
      font-size: 14px;
      color: #000;
    }

    .buttons {
      display: flex;
      font-family: AlibabaPuHuiTi_2_65_;
      font-size: 12px;
      color: #999;

      div {
        cursor: pointer;
      }
    }
  }
}
</style>